<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>注册</title>
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>
</head>
<body>
<div class="bg"></div>
<div class="container">
    <div class="line bouncein">
        <div class="xs6 xm4 xs3-move xm4-move">
            <div style="height:0px;"></div>
            <div class="media media-y margin-big-bottom">
            </div>
            <form action="register.php" method="post" onsubmit="return check()">
                <div class="panel loginbox">
                    <div class="text-center margin-big padding-big-top"><h1>注册</h1></div>
                    <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="text" class="input input-big" name="username" placeholder="您的姓名" data-validate="required:请填写账号" />
                                <span class="icon icon-user margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="text" class="input input-big" name="number" placeholder="你的工号&学号" data-validate="required:请填写工号&学号" />
                                <span class="icon icon-user margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field field-icon-right">
                                <input type="password" class="input input-big" name="password" placeholder="登录密码" data-validate="required:请填写密码" />
                                <span class="icon icon-key margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field">
                                <input type="password" class="input input-big" name="repassword" placeholder="确认密码" data-validate="required:请确认密码" />
                            </div>
                        </div>

                        <div style="height: 10px;"></div>
                        <div class="form-group">
                            <div class="field">
                                <label for="id" style="font-size: 14px">请选择您的身份:</label>
                                <select name="role_type" id="id" class="input input-big">
                                    <option value="teacher">老师</option>
                                    <option value="student">学生</option>
                                </select>
                            </div>
                        </div>


                    </div>
                    <div style="padding:20px;"><input type="submit" class="button button-block bg-main text-big input-big" value="注册"></div>
                    <div class="back2login"><a  href="./login.html" style="float: right; font-family: 微软雅黑;font-weight: bold">返回登录</a></div>
                </div>

            </form>


        </div>
    </div>
</div>

<script>
    function check(){
        var a="$&*#";
        var b;
        for(i=0 ;i<username.value.length;i++){
            b=username.value.charAt(i);
            if(a.indexOf(b)>=0){
                alert("姓名里不能含有非法字符$&*#");
                return false;}
        }

        var d=password.value;
        var e=repassword.value;
        if(d!=e){
            alert('密码和确认密码不一致');
            password.focus();
            return false;
        }
        var f="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        var g="1234567890";
        var j;
        var k;
        var cc=0;
        var dd=0;
        for(j=0;j<password.value.length;j++){
            k=password.value.charAt(j);
            if(f.indexOf(k)>=0){
                ++cc ;
            }
            if(g.indexOf(k)>=0){
                ++dd ;
            }
        }
        if(cc==0 || dd==0){
            alert('密码必须包括字母和数字');
            password.focus();
            return false;
        }
    }</script>

</body>
</html>